import React from 'react';
import { View } from '@tarojs/components';
import Taro from '@tarojs/taro';

import './index.scss';

const TopHead = ({ title = '' }) => {
  let statusBarHeight = Taro.$statusBarHeight;
  let titleHeight = Taro.$titleHeight;
  if (Taro.$isH5) {
    statusBarHeight = 0;
    titleHeight = 88;
  }
  let topHeight = statusBarHeight + titleHeight;

  return (
    <View
      className="TopHead customeTopStyle"
      style={{ height: topHeight + 'px', paddingTop: statusBarHeight + 'px' }}
    >
      <View className="title">{title}</View>
    </View>
  );
};

export default TopHead;
